Skip to main content

SEC EDGAR agentkit for smolagents

A lightweight integration of SEC EDGAR data access tools for Hugging Face's smolagents framework.

Installation

pip install sec-edgar-agentkit-smolagents
# or
pip install -r requirements.txt

Quick Start

from sec_edgar_smolagents import create_sec_edgar_agent

# Create an agent with all SEC EDGAR tools
agent = create_sec_edgar_agent("gpt-4")

# Ask questions about companies and filings
result = agent.run("What was Apple's revenue last year?")
print(result)

Available Tools

  • CIKLookupTool - Look up company CIK by name or ticker
  • CompanyInfoTool - Get detailed company information
  • CompanyFactsTool - Retrieve XBRL company facts
  • FilingSearchTool - Search for SEC filings
  • FilingContentTool - Extract filing content
  • Analyze8KTool - Analyze 8-K material events
  • FinancialStatementsTool - Extract financial statements
  • XBRLParseTool - Parse XBRL data
  • InsiderTradingTool - Analyze Forms 3/4/5

Usage Examples

Basic Company Research

from sec_edgar_smolagents import create_sec_edgar_agent

agent = create_sec_edgar_agent("gpt-4")

# Simple queries
agent.run("Find Microsoft's latest 10-K filing")
agent.run("What were Tesla's material events in the last quarter?")
agent.run("Show me insider trading activity for Apple")

Using Specific Tools

from sec_edgar_smolagents import CIKLookupTool, FilingSearchTool

# Create agent with only specific tools
agent = create_sec_edgar_agent(
    "gpt-4",
    tools=[CIKLookupTool(), FilingSearchTool()]
)

result = agent.run("Find Amazon's CIK and recent filings")

Different Model Providers

# OpenAI
agent = create_sec_edgar_agent("gpt-4")

# Anthropic
agent = create_sec_edgar_agent("claude-3-opus-20240229")

# Hugging Face API
from smolagents import HfApiModel
model = HfApiModel("meta-llama/Llama-3-8b-instruct")
agent = create_sec_edgar_agent(model)

# Local model
from smolagents import TransformersModel
model = TransformersModel("microsoft/Phi-3-mini-4k-instruct")
agent = create_sec_edgar_agent(model)

Financial Analysis

agent = create_sec_edgar_agent("gpt-4")

# Complex multi-step analysis
analysis = agent.run("""
    1. Find Apple's last 3 years of 10-K filings
    2. Extract revenue and net income from each
    3. Calculate year-over-year growth rates
    4. Compare with Microsoft's performance
""")

print(analysis)

MCP Server Configuration

The tools connect to the sec-edgar-mcp server. By default, it looks for the server at the sec-edgar-mcp command. You can customize this:

from sec_edgar_smolagents import SECEdgarToolkit
from sec_edgar_smolagents.mcp_client import MCPClient

# Custom MCP server command
client = MCPClient(server_command="/path/to/sec-edgar-mcp")
toolkit = SECEdgarToolkit(mcp_client=client)

agent = create_sec_edgar_agent("gpt-4", tools=toolkit.get_tools())

Development

Running Tests

pytest integrations/smolagents/__tests__/

Running Examples

cd integrations/smolagents
python examples/basic_usage.py
python examples/financial_analysis.py

Requirements

  • Python 3.8+
  • smolagents >= 0.1.0
  • sec-edgar-mcp server installed (pip install sec-edgar-mcp)

License

AGPL-3.0 - See LICENSE for details.

Author

Stefano Amorelli stefano@amorelli.tech

Metadata

Release files for sec-edgar-agentkit-smolagents 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sec-edgar-agentkit-smolagents 0.1.0
File Size Uploaded
sec_edgar_agentkit_smolagents-0.1.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sec-edgar-agentkit-smolagents 0.1.0
File Interpreter ABI Platform
sec_edgar_agentkit_smolagents-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / sec_edgar_agentkit_smolagents-0.1.0.tar.gz

Download URL sec_edgar_agentkit_smolagents-0.1.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b21c4ad84fa025267d58399801a5422f939487fa9f5a6ee443de33a9a08637aa
BLAKE2b-256 checksum
How to use checksums
0852a19b665d4565b7abc8b9f93b018e6af17f0973305de2b403788d7a1130f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / sec_edgar_agentkit_smolagents-0.1.0-py3-none-any.whl

Download URL sec_edgar_agentkit_smolagents-0.1.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58473b9833e3a8a846d15bcb33babd30aa7accac30a27be0b1dda6258b961627
BLAKE2b-256 checksum
How to use checksums
1036ff4c1b4ee2a1cdbeb878621887a4fa399c0d3b9c92b49f8a8b1cf96de528
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page