4 karma · joined Dec 11, 2012 (13y ago) · 4 submissions
comment 11mo ago · link · parent
Queries are lazy—you build expressions first, then execute via slicing.
Example – find when a team is free for a 2+ hour meeting:
from calgebra import day_of_week, time_of_day, hours, HOUR
# Define business hours
weekend = day_of_week(["saturday", "sunday"], tz="US/Pacific")
weekdays = ~weekend
business_hours = weekdays & time_of_day(start=9*HOUR, duration=8*HOUR, tz="US/Pacific")
# Team calendars (Google Calendar, .ics files, etc.)
team_busy = alice | bob | charlie
# One expression to find available slots
free_slots = (business_hours - team_busy) & (hours >= 2)
Features:- Set operations on any timeline source
- Recurring patterns via RFC 5545 (dateutil under the hood)
- Filter by duration, metadata, or custom properties
- Google Calendar read/write
- iCalendar (.ics) import/export
Fwiw, I think focused DSLs are a great pairing with code-focused agents like huggingface's smol-agents or agex (my other hobby project).
Video of a calgebra-enabled agent: https://youtu.be/10kG4tw0D4k
Would love feedback!
2.
Show HN: Calgebra – Set algebra for calendars in Python(github.com ↗)
5 points · by ashenfad · 11mo ago · 2 comments
comment 1y ago · link · parent
Its closest relative is Hugging Face's excellent `smol-agents`. While both "think-in-code", `agex` focuses on interoperability, allowing agents to receive and return complex Python objects like DataFrames, Plotly figures, or even callables.
For example:
import math
from typing import Callable
from agex import Agent
agent = Agent(primer="You are an expert at writing small, useful functions.")
# Equip the agent with the math module
agent.module(math)
# The fn sig is the contract; the agent provides the implementation at runtime
@agent.task
def build_function(prompt: str) -> Callable:
"""Build a callable function from a text prompt."""
pass
# The agent returns a real, callable Python function, not a JSON blob
is_prime = build_function("a function that checks if a number is prime")
# You can use it immediately
print(f"Is 13 prime? {is_prime(13)}")
# > Is 13 prime? True
From the agent's point-of-view, it lives in a Python REPL with its own stdout, allowing it to inspect data, see errors, and self-correct. An agent's REPL is persisted across tasks, so it can build its own helpers and improve over time.Highlights:
* Code-as-Action: AST-style Python sandbox for agent actions.
* Library Integration: Plug into libraries rather than tools (& skip the JSON).
* Workspace Persistence: Git-like versioning for agent state (w/ time-travel debugging).
* Multi-Agent: Orchestrate agents with natural Python control flow.
* Observability: Real-time, notebook-friendly event streams.
* Benchmarking: A framework for data-driven agent evaluation.
The project is early stage but the core concepts are stabilizing. I'm hoping to find a few brave souls to kick the tires. Feedback is welcome.GitHub: https://github.com/ashenfad/agex
Docs & Examples: https://ashenfad.github.io/agex/
4.
Show HN: Agex – An agent framework that lives in your Python runtime(ashenfad.github.io ↗)
5 points · by ashenfad · 1y ago · 1 comment