How It Works
Fishnet acts as a transparent proxy between LangChain and AI providers:- Configure LangChain’s OpenAI/Anthropic clients to use Fishnet’s proxy URL
- LangChain sends all requests to
localhost:8473 - Fishnet applies security policies (spend caps, prompt drift detection, etc.)
- Fishnet injects credentials from its encrypted vault
- Requests are forwarded to the real provider
- All actions are logged in Fishnet’s audit trail
Prerequisites
- Fishnet running locally (see Installation)
- LangChain installed:
pip install langchain langchain-openai langchain-anthropic - API keys stored in Fishnet’s vault
Setup
Add credentials to Fishnet
Store your API keys in Fishnet’s encrypted vault:
Fishnet encrypts these keys. Your LangChain code will never see them.
Run your LangChain application
Execute your code normally. All LLM requests now flow through Fishnet:
Advanced Usage
Streaming Responses
Fishnet supports streaming for both OpenAI and Anthropic:Multi-Agent Systems
When using multiple LangChain agents, all inherit Fishnet’s protection:RAG Pipelines
Fishnet works seamlessly with retrieval-augmented generation:Security Policies
Model Allowlisting
Restrict which models your LangChain app can use:gpt-3.5-turbo, Fishnet blocks it.
Spend Tracking
Fishnet tracks every LangChain request’s token usage and cost:Rate Limiting
Prevent your LangChain agents from flooding providers:Prompt Safety
Detect when system prompts deviate from expected baselines:Example: Full LangChain Agent with Fishnet
- Injects credentials
- Tracks token usage and cost
- Enforces rate limits
- Logs all actions
- Applies prompt drift detection
Troubleshooting
Connection refused
Connection refused
Ensure Fishnet is running:Start if needed:
Authentication errors
Authentication errors
Verify credentials are stored:Add missing keys:
Model not allowed
Model not allowed
Check your allowlist in Either add the model or update your LangChain code to use an allowed model.
fishnet.toml:Budget exceeded
Budget exceeded
Your daily spend cap was hit. View spend:Increase the budget in Restart Fishnet to apply changes:
fishnet.toml:Next Steps
Credential Vault
Learn how Fishnet stores and injects API keys
Spend Limits
Configure budgets and track costs
Prompt Drift Detection
Protect against prompt injection attacks
Audit Trail
Review and export all LangChain requests